package com.dinner.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dinner.entity.DiMenu;
import com.dinner.mapper.DiMenuMapper;
import com.dinner.service.DiMenuService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author dinner
 * @since 2022-02-12
 */
@Service
public class DiMenuServiceImpl extends ServiceImpl<DiMenuMapper, DiMenu> implements DiMenuService {
    @Autowired
    DiMenuMapper diMenuMapper;
    @Override
    public List<DiMenu> findMenuDesc(int size, int current) {
        QueryWrapper queryWrapper=new QueryWrapper();
        queryWrapper.orderByDesc("menu_sale");
        Page<DiMenu> page=new Page<>(size,current);
        Page<DiMenu> pages=diMenuMapper.selectPage(page,queryWrapper);
        List<DiMenu> list=pages.getRecords();
        return list;
    }

}
